//
//  SysMenu.m
//  lust
//
//  Created by fan on 13-3-28.
//
//

#import "SysMenu.h"
#import "cocos2d.h"
#import "GameLayer.h"
#import "SettingLayer.h"
@implementation SysMenu
+(CCScene*)scene
{
    CCScene* scene=[CCScene node];
    [scene addChild:[SysMenu node]];
    return scene;
}
-(id)init
{
    self=[super init];
    if (self) {
        CCSprite* sp=[CCSprite spriteWithFile:@"bg.png"];
        sp.anchorPoint=CGPointZero;
        [self addChild:sp z:0 tag:1];
        [CCMenuItemFont setFontName:@"Marker Felt"];
        [CCMenuItemFont setFontSize:25];
        
        CCMenuItem* newGame=[CCMenuItemFont itemWithString:@"New Game" target:self selector:@selector(newGame:)];
        CCMenuItem* oldGame=[CCMenuItemFont itemWithString:@"Old Game" target:self selector:nil];
        CCMenuItem* setting=[CCMenuItemFont itemWithString:@"Setting" target:self selector:@selector(onSettings:)];
        CCMenuItem* help=[CCMenuItemFont itemWithString:@"Help" target:self selector:nil];
        CCMenuItem* quit=[CCMenuItemFont itemWithString:@"Quit" target:self selector:@selector(onQuit:)];
        
        CCMenu* mn=[CCMenu menuWithItems:newGame,oldGame,setting,help,quit, nil];
        [mn alignItemsVertically];
        [self addChild:mn z:1 tag:2];
    }
    return self;
}

-(void)newGame:(id)sender
{
    [[CCDirector sharedDirector]replaceScene:[GameLayer scene]];
}
-(void)onSettings:(id)sender
{
    [[CCDirector sharedDirector] replaceScene:[SettingLayer scene]];
}

@end
